import pygame
import sys
from init_map import InitMap


class Map(InitMap):
    def __init__(self, *args):
        InitMap.__init__(self)

        self.door_red = pygame.image.load("../资源/图片/红门.jpg").convert_alpha()
        self.door_iron = pygame.image.load("../资源/图片/铁门.png").convert_alpha()
        self.princess = pygame.image.load("../资源/图片/公主.png").convert_alpha()

        self.hero_pos = (1, 10)
        self.up_pos = (10, 10)
        self.down_pos = (0, 10)
        self.variable_pos = {
            (5, 6): (self.door_red, '红门'),
            (5, 7): (self.door_red, '红门'),
            (5, 5): (self.door_iron, '铁门'),
            (5, 4): (self.princess, '公主'),
            (5, 8): (self.wall, '墙'),
            (5, 9): (self.wall, '墙'),
        }
        self.open_up = False

    def fixed_brick(self):
        if self.open_up:
            self.draw(self.upstairs, self.up_pos[0], self.up_pos[1])
            self.dic[self.up_pos] = '上楼'
        self.draw(self.downstairs, self.down_pos[0], self.down_pos[1])
        self.dic[self.down_pos] = '下楼'
        for i in range(11):
            for j in range(10):
                if not (i == 5 and j in [4, 5, 6, 7, 8, 9]):
                    self.draw(self.wall, i, j)
                    self.dic[(i, j)] = '墙'
        for i in self.ls:
            self.screen.blit(self.road, i)
            self.dic[(int((i[0]-375)/48), int((i[1]-25)/48))] = '路'
